package com.cincc.cincc_pbx.model;

import com.cincc.cincc_pbx.common.MyUtils;

public class CallRecordModel {
    //被叫号码
    private String phone;
    //呼叫开始时间
    private String beginTime;
    //通话时长
    private String duration;
    //通话结束原因
    //0 应答后主叫挂机;
    //1 应答后被叫挂机;
    //2 应答后最大通话时长超时挂
    //机;
    //10 应答前主叫放弃;
    //>=300被叫未接通错误码
    private String releaseCause;
    //1：主叫话单;
    //2：被叫话单;
    //3：前转话单;
    //4：一号通被叫话单;
    //100：质检
    private String acrType;

    public CallRecordModel(String phone, String beginTime, int duration, String releaseCause, String acrType) {
        this.phone = phone;
        this.beginTime = beginTime.substring(4, 6) + "." + beginTime.substring(6, 8) + " " + beginTime.substring(8, 10) + ":" + beginTime.substring(10, 12);
        String type = acrType.equals("1") ? "呼出" : "呼入";
        String durationStr = duration == 0 ? "0秒" : MyUtils.convertSecondsToHMS(duration);
        this.duration = type + durationStr;
        this.releaseCause = releaseCause;
        this.acrType = acrType;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public String getBeginTime() {
        return beginTime;
    }

    public void setBeginTime(String beginTime) {
        this.beginTime = beginTime;
    }

    public String getDuration() {
        return duration;
    }

    public void setDuration(String duration) {
        this.duration = duration;
    }

    public String getReleaseCause() {
        return releaseCause;
    }

    public void setReleaseCause(String releaseCause) {
        this.releaseCause = releaseCause;
    }

    public String getAcrType() {
        return acrType;
    }

    public void setAcrType(String acrType) {
        this.acrType = acrType;
    }
}
